﻿@{
    ViewData["Title"] = "基建档案检索";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section head{

    <link href="/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet" />
    <link href="/css/select2/select2.min.css" rel="stylesheet" />
    <style type="text/css">
        .dSearch .btn {
            margin-top: -3px;
        }

        .dSearch .form-control {
            display: inline-block;
        }

        .dSearch .layer-date {
            margin-top: -7px;
        }

        .dataTables_wrapper {
            padding-bottom: 0px;
        }

        div.dataTables_scrollBody table {
            margin-top: -18px !important;
        }

        .fixed-table-pagination .pagination-detail, .fixed-table-pagination div.pagination {
            margin-bottom: 0px;
        }

        .card_table tbody tr td {
            border: none;
        }

        #dSearch table tr td {
            padding: 8px;
        }

        #dSearch .input-group {
            width: 100%;
        }

        #dSearch .input-group-addon {
            width: 100px;
        }

        #dSearch .fix-border {
            border-left: none;
            border-right: none;
        }

        .fixed-table-toolbar .search {
            width: 200px;
        }

        #searchbtn {
            margin-top: 10px;
            font-size: 10pt;
            line-height: 16px;
            height: 30px;
        }
    </style>
}
<form id="form1" runat="server">

    <div id="dMain">
        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="ibox" style="margin-bottom: 0px;">
                <div class="ibox-title">
                    <h5>基建档案检索</h5>
                </div>
                <div class="ibox-content">
                    <div id="collapseOne" class="panel-collapse collapse">
                        <div class="panel-body">
                            <div class="dSearch">
                                <input type="text" id="txtFileNo" class="form-control" placeholder="档号" style="width:130px;" />
                                <input type="text" id="txtND1" class="form-control" style="width:80px;" placeholder="开始年度" onclick="WdatePicker({dateFmt: 'yyyy'})" />
                                至
                                <input type="text" id="txtND2" class="form-control" style="width:80px;" placeholder="结束年度" onclick="WdatePicker({dateFmt: 'yyyy'})" />
                                <select id="ddlLJDW" class="form-control" style="width: 150px;" placeholder="立卷单位"></select>
                                <input type="text" ID="txtAY" Class="form-control" placeholder="案由" style="width:130px;" />
                                <input type="text" ID="txtName" Class="form-control" placeholder="姓名" style="width:130px;" />
                                <input type="text" ID="txtSecondSearch" Class="form-control" placeholder="卷内目录" style="width:200px;" />
                                <a id="search" class="btn btn-sm btn-primary" onclick="getTEquipmentList()"><i class="icon-search"></i>&nbsp;快速检索</a>
                                <a class="btn btn-sm btn-primary" onclick="ShowDivOfPage('#myModal','综合检索',900,480)"><i class="icon-stack"></i>&nbsp;综合检索</a>
                            </div>
                        </div>
                    </div>

                    <div id="toolbar">
                        <a data-toggle="collapse" data-parent="#accordion" id="searchbtn" class="btn btn-sm btn-primary" href="tabs_panels.html#collapseOne">检索</a>
                        <a class="btn btn-sm btn-primary btn-pd" onclick="Apply()" style="margin-top: 10px;">阅卷申请</a>


                        <a class="btn btn-sm btn-primary" onclick="LitigationPrint()" style="margin-top: 10px; margin-left: 10px;">档案目录打印</a>
                        <div id="divJPDY" class="btn-group" style="margin-top: 10px;">
                            <a class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown">
                                卷皮全打<span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="btn-pd" onclick="PrintCoverAll(1,1)" style="margin-top: 10px; margin-right: 5px;">刑事诉讼新卷皮打印</a></li>
                                <li><a class="btn-pd" onclick="PrintCoverAll(2,1)" style="margin-top: 10px; margin-right: 5px;">民事行政新卷皮打印</a></li>
                                <li><a class="btn-pd" onclick="PrintCoverAll(3,1)" style="margin-top: 10px; margin-right: 5px;">公益诉讼卷皮打印</a></li>
                                <li><a class="btn-pd" onclick="PrintCoverAll(1,2)" style="margin-top: 10px; margin-right: 5px;">刑事诉讼旧卷皮打印</a></li>
                                <li><a class="btn-pd" onclick="PrintCoverAll(2,2)" style="margin-top: 10px; margin-right: 5px;">民事行政旧卷皮打印</a></li>
                            </ul>
                        </div>
                        <div id="divJPDY1" class="btn-group" style="margin-top: 10px;">
                            <a class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown">
                                卷皮套打<span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a class="btn-pd" onclick="PrintCoverAll(4,1)" style="margin-top: 10px; margin-right: 5px;">刑事诉讼新卷皮打印</a></li>
                                <li><a class="btn-pd" onclick="PrintCoverAll(5,1)" style="margin-top: 10px; margin-right: 5px;">民事行政新卷皮打印</a></li>
                                <li><a class="btn-pd" onclick="PrintCoverAll(6,1)" style="margin-top: 10px; margin-right: 5px;">公益诉讼卷皮打印</a></li>
                            </ul>
                        </div>
            
                        <div class="text-danger" style="position: absolute; font-size: 14px; margin-top: 15px; margin-left: 310px"><i class="fa fa-hand-o-right"></i>&nbsp;提示：双击行可查看该诉讼档案的详细信息！</div>
                    </div>
                    <table id="tabData" class="table table-bordered scrolltable" style="width: 3500px;">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>序号</th>
                                <th>档号</th>
                                <th>立卷单位</th>
                                <th>统一受案号</th>
                                <th>字号</th>
                                <th>案由</th>
                                <th>当事人</th>
                                <th>案件来源</th>
                                <th>申诉人</th>
                                <th>被申诉人</th>
                                <th>犯罪嫌疑人/被告人</th>
                                <th>申请人</th>
                                <th>其他当事人</th>
                                <th>终审法院</th>
                                <th>承办人</th>
                                <th>主办单位</th>
                                <th>收案日期</th>
                                <th>结案日期</th>
                                <th>办理结果</th>
                                <th>监督对象</th>
                                <th>诉前程序</th>
                                <th>归档日期</th>
                                <th>期限</th>
                                <th>密级</th>
                                <th>页数</th>
                                <th>线索编号</th>
                                <th>状态</th>
                            </tr>
                        </thead>
                    </table>
                    <hr style="height: 1px; border: none; border-top: 1px dashed #1E90FF; margin-top: 3px; margin-bottom: 5px;" />
                    <table id="tabData2" class="table table-bordered scrolltable" style="width: 100%;">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>序号</th>
                                <th>文号</th>
                                <th>责任者</th>
                                <th>题名</th>
                                <th>日期</th>
                                <th>页号</th>
                                <th>备注</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div id="myModal" style="display: none;">
        <div id="dSearch">
            <table style="width: 100%;">
                <colgroup>
                    <col style="width: 33.3%;" />
                    <col style="width: 33.3%;" />
                    <col style="width: 33.3%;" />
                </colgroup>
                <tr>
                    <th>一级目录</th>
                </tr>
                <tr>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">档号</span>
                            @*<asp:TextBox ID="txtFileNo2" runat="server" CssClass="form-control"></asp:TextBox>*@
                            <input type="text" id="txtFileNo2" class="form-control" placeholder="档号" style="width:130px;" />
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">字号</span>
                            @*<asp:TextBox ID="txtZH" runat="server" CssClass="form-control"></asp:TextBox>*@
                            <input type="text" id="txtZH" class="form-control" placeholder="档号" style="width:130px;" />
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">立卷单位</span>
                            <asp:DropDownList ID="ddlLJDW1" runat="server" CssClass="form-control"></asp:DropDownList>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">案由</span>
                            <asp:TextBox ID="txtAY2" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">当事人</span>
                            <asp:TextBox ID="txtDSR2" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">申诉人</span>
                            <asp:TextBox ID="txtSSR" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">犯罪嫌疑人</span>
                            <asp:TextBox ID="txtFZXYRBGR" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">申请人</span>
                            <asp:TextBox ID="txtLawyer" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">其他当事人</span>
                            <asp:TextBox ID="txtLawyerUnit" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">承办人</span>
                            <asp:TextBox ID="txtCBR" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">主办单位</span>
                            <asp:TextBox ID="txtZBDW" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">期限</span>
                            <asp:DropDownList ID="ddlFTerm2" runat="server" CssClass="form-control"></asp:DropDownList>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">密级</span>
                            <asp:DropDownList ID="ddlMJ" runat="server" CssClass="form-control"></asp:DropDownList>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">收案日期</span>
                            <asp:TextBox ID="txtSARQ1" runat="server" CssClass="form-control" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})"></asp:TextBox>
                            <span class="input-group-addon fix-border fix-padding" style="width: 30px;">至</span>
                            <asp:TextBox ID="txtSARQ2" runat="server" CssClass="form-control" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">结案日期</span>
                            <asp:TextBox ID="txtJARQ1" runat="server" CssClass="form-control" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})"></asp:TextBox>
                            <span class="input-group-addon fix-border fix-padding" style="width: 30px;">至</span>
                            <asp:TextBox ID="txtJARQ2" runat="server" CssClass="form-control" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})"></asp:TextBox>
                        </div>
                    </td>
                </tr>
                <tr style="display: none;">
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">检察长</span>
                            <asp:TextBox ID="txtJCZ" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">检察员</span>
                            <asp:TextBox ID="txtJCY" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group" style="margin-bottom: 0px;">
                            <span class="input-group-addon">书记员</span>
                            <asp:TextBox ID="txtSJY" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div class="input-group" style="margin-bottom: 0px;">
                            <span class="input-group-addon">归档日期</span>
                            <asp:TextBox ID="txtGDRQ1" runat="server" CssClass="form-control" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})"></asp:TextBox>
                            <span class="input-group-addon fix-border fix-padding" style="width: 30px;">至</span>
                            <asp:TextBox ID="txtGDRQ2" runat="server" CssClass="form-control" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd'})"></asp:TextBox>
                        </div>
                    </td>
                </tr>

                <tr>
                    <th>二级目录</th>
                </tr>
                <tr>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">题名</span>
                            <asp:TextBox ID="txtSecondDirName" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">文号</span>
                            <asp:TextBox ID="txtSecondArticleNo" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                    <td>
                        <div class="input-group">
                            <span class="input-group-addon">责任者</span>
                            <asp:TextBox ID="txtSecondResponsibilityer" runat="server" CssClass="form-control"></asp:TextBox>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="modal-footer">
            <asp:Button ID="btnSearch" runat="server" CssClass="btn btn-primary btn-sm" OnClientClick="return verfic('tip', '#dSearch');" OnClick="btnSearch_Click" Text="检索" />
            <input id="btnClose" type="button" class="btn btn-default btn-sm" value="取消" onclick="CloseDiv()" />
        </div>
    </div>
</form>
@section scripts{

    <script src="/js/plugins/jeditable/jquery.jeditable.js"></script>
    <script src="/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
    <script src="/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="/js/plugins/bootstrap-table/bootstrap-table-export.js"></script>
    <script src="/js/plugins/bootstrap-table/tableExport.js"></script>
    <script src="/js/plugins/bootstrap-table/bootstrap-table-cookie.js"></script>
    <script src="/js/content.min.js"></script>
    <script src="/js/My97DatePicker/WdatePicker.js"></script>
    <script src="/js/plugins/layer/layer.min.js"></script>
    <script src="/js/store.js"></script>
    <script src="/js/verification.js"></script>
    <script src="/js/select2/select2.min.js"></script>
    <script src="/js/zuiCode.js"></script>

    <script type="text/javascript">
        var tabHeight = 0;
        $(function () {

            tabHeight = (GetHeight() - 150) / 2//将两个表格平分高
            BindTab2("");

            $('#tabData').bootstrapTable({
                height: tabHeight + 50,
                url:  "@Url.Action("GetJiJianJsonData", "JiJian")",
                // data: $("#dJson").text() != "" ? JSON.parse($("#dJson").text()) : "",
                dataType: "json",
                pagination: true,	//在表格底部显示分页工具栏
                pageSize: 50,  //分页条数
                pageNumber: 1,    //初始化加载第一页，默认第一页
                pageList: [50, 100, 200, 500, 1000, 1500, 2000],
                queryParamsType: 'limit',
                toolbar: '#toolbar',//工具按钮用哪个容器
                silent: true,  //刷新事件必须设置
                buttonsClass: "sm btn-white",//按钮class
                clickToSelect: false,//设置true将在点击行时，自动选择单选或复选框
                singleSelect: false,//为true则禁止多选
                queryParams: queryParams,//查询参数
                sidePagination: 'server', //服务端
                showColumns: true,//是否显示所有的列
                showRefresh: true,//是否显示刷新按钮
                search: true,//是否启用搜索
                showPaginationSwitch: true,//是否显示分页切换按钮
                showExport: true,//是否启用导出
                striped: true,//是否显示行间隔色
                exportOptions: {
                    ignoreColumn: [0],  //忽略某一列的索引
                },
                responseHandler: function (msg) { //数据加载转换
                    if (msg.result == 1) {
                        return {
                            "total": msg.totalCount,//总页数
                            "rows": JSON.parse(msg.jsonData) //数据
                        };
                    }
                    else {
                        showTip("数据加载失败！", 2);
                    }
                },
                columns: [
                    { align: 'center', width: "50px", checkbox: true },
                    { align: 'center', formatter: number },
                    { align: 'left', width: "220px", sortable: true, formatter: operateFormatter2 },
                    { field: 'OrgName', align: 'left', width: "120px", sortable: true },
                    { field: 'TYSAH', align: 'left', width: "180px", sortable: true },
                    { field: 'DangHao', align: 'left', width: "200px", sortable: true },
                    { field: 'CaseCause', align: 'left', width: "250px" },
                    { field: 'Litigant2', align: 'left', width: "300px" },
                    { field: 'LaiYuan', align: 'left', width: "250px" },
                    { field: 'SSR', align: 'left', width: "150px", sortable: true },
                    { field: 'BSSR', align: 'left', width: "150px", sortable: true },
                    { field: 'FZXYRBGR', align: 'left', width: "150px", sortable: true },
                    { field: 'Lawyer', align: 'left', width: "150px", sortable: true },
                    { field: 'LawyerUnit', align: 'left', width: "150px", sortable: true },
                    { field: 'UnDepart', align: 'left', width: "200px" },
                    { field: 'Undertaker', align: 'left', width: "150px" },
                    { field: 'DanWei', align: 'left', width: "180px" },
                    { field: 'RecordDate', align: 'center', width: "100px", sortable: true },
                    { field: 'SettleDate', align: 'center', width: "100px", sortable: true },
                    { field: 'Result1', align: 'left', width: "300px" },
                    { field: 'JDDX', align: 'left', width: "200px" },
                    { field: 'SQCX', align: 'left', width: "100px" },
                    { field: 'KeptFileDate', align: 'center', width: "100px", sortable: true },
                    { field: 'FTermName', align: 'center', width: "100px", sortable: true },
                    { field: 'Secure', align: 'center', width: "100px", sortable: true },
                    { field: 'PageCount', align: 'center', width: "100px", sortable: true },
                    { field: 'CluesNo', align: 'center', width: "100px", sortable: true },
                    { align: 'center', width: "100px", sortable: true, formatter: fileState }
                ],
                onLoadError: function () { //加载失败事件
                    //showTip("数据加载中，请等待！", 2);
                },
                onDblClickRow: function (row, obj) { //双击行事件
                    if (row.Flag3 != 1) {
                        window.top.showFullPage("图像阅读器", "/See.aspx?FID=" + row.ID);
                    }
                    else if (row.Flag3 == 1) {
                        showTip("档案被封存,无法查看原文件", 2, 2);
                    }
                },
                onClickRow: function (row, obj) { //单击行事件
                    $(obj).parent().find("tr").removeClass("selected");
                    $(obj).addClass("selected");

                    //根据选中的行获取子表数据
                    GetSonData(row.ID, row.Flag3);
                },
                onLoadSuccess: function () {
                    var txtsearch = $(".form-control[placeholder='搜索']").val();
                    if (txtsearch != null && txtsearch != '') {
                        $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                            var str = "<span class=\"bg-yellow\">" + txtsearch + "</span>";
                            var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(txtsearch, str);
                            $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                        })
                    }
                    else {
                        var txtName = document.getElementById("txtName").value;
                        if (txtName != "") {
                            if (txtName.indexOf(",") != -1 || txtName.indexOf("，") != -1) {
                                $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                                    var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text();
                                    var strs = new Array(); //定义一数组
                                    strs = txtName.replaceAll("，", ",").split(","); //字符分割
                                    for (j = 0; j < strs.length; j++) {
                                        var str = "<span class=\"bg-yellow\">" + strs[j] + "</span>";
                                        NewText = NewText.replaceAll(strs[j], str);
                                    }
                                    $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                })
                            }
                            else {
                                $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                                    var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text();
                                    var str = "<span class=\"bg-yellow\">" + txtName + "</span>";
                                    var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(txtName, str);
                                    $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                })
                            }
                        }

                        var txtSecondSearch = document.getElementById("txtSecondSearch").value;
                        if (txtSecondSearch != "") {
                            if (txtSecondSearch.indexOf(",") != -1 || txtSecondSearch.indexOf("，") != -1) {
                                $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                                    var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text();
                                    var strs = new Array(); //定义一数组
                                    strs = txtSecondSearch.replaceAll("，", ",").split(","); //字符分割
                                    for (j = 0; j < strs.length; j++) {
                                        var str = "<span class=\"bg-yellow\">" + strs[j] + "</span>";
                                        NewText = NewText.replaceAll(strs[j], str);
                                    }
                                    $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                })
                            }
                            else {
                                $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                                    var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text();
                                    var str = "<span class=\"bg-yellow\">" + txtSecondSearch + "</span>";
                                    var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(txtSecondSearch, str);
                                    $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                })
                            }
                        }
                    }
                },
                //onPageChange: function () {
                //    var gjzd = $(".form-control[placeholder='搜索']").val()
                //    $("#tabData tbody tr td:not(.bs-checkbox)").each(function (i) {
                //        var str = "<span class=\"bg-yellow\">" + gjzd + "</span>";
                //        var NewText = $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(gjzd, str);
                //        $("#tabData tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                //    })
                //}
            });

            function fileState(value, row, index) {
                if (row.Flag3 == 0) {
                    return ["<span class=\"text-success\">正常</span>"];
                }
                else if (row.Flag3 == 1) {
                    return ["<span class=\"text-danger\">封存</span>"];
                }
            };
        });

        //请求服务数据时所传参数
        function queryParams(params) {
            return {
                PageSize: params.pageSize,      // 页数
                PageIndex: params.pageNumber,  // 页码
                Sort: params.sort,              // 排序字段
                Order: params.order,            // 升序、降序
                type: 'GetDataForSSList',       //方法名
                search: params.search,
                txtFileNo: $("#txtFileNo").val(),
                txtStarND: $("#txtND1").val(),
                txtEndND: $("#txtND2").val(),
                txtFTrem: $("#ddlFTerm").val(),
                txtDW: $("#ddlLJDW").val(),
                txtAY: $("#txtAY").val(),
                txtName: $("#txtName").val(),
                txtSecondSearch: $("#txtSecondSearch").val()
            }
        }

        //模糊查询功能
        function getTEquipmentList() {
            $("#tabData").bootstrapTable('refresh');
        }

        //执行回车不刷新页面
        document.onkeydown = function () {
            if (event.keyCode == 13) {
                $("#tabData").bootstrapTable('refresh');
                event.returnValue = false;
            }
        }

        function operateFormatter2(value, row, index) {
            return [
                "<i class=\"fa fa-file-picture-o\" style='color: " + (row.TureCount != 0 ? "#38B03F" : "#bbb") + "'></i>&nbsp;" + (row.FileNo)
            ];
        }

        function number(value, row, index) {
            return index + 1;
        }

        function ImportForPDF(_id) {
            // DataLoading();
            $.ajax({
                type: "post",
                url: "ashx/Files.ashx",
                dataType: "json",
                async: true,
                data: { type: "GetImportForPDF", ID: _id },
                success: function (msg) {
                    if (msg.result == 1) {
                        location.href = "/DownloadTemp/" + msg.fileName;
                    }
                    else {
                        showTip("导出失败！！！", 2);
                        location.href = location.href;
                    }
                },
                error: function () {
                    showTip("导出失败！！！", 2);
                }
            });
        }

        $('#ddlFTerm').select2();
        $('#ddlLJDW').select2();

        //阅卷申请
        function Apply() {
            var FilesApply_FIDS = "";
            $.map($('#tabData').bootstrapTable('getSelections'), function (row) {
                if (FilesApply_FIDS == "") {
                    FilesApply_FIDS += row.ID;
                }
                else {
                    FilesApply_FIDS += "," + row.ID;
                }
            });

            if (FilesApply_FIDS != "") {
                store.set("FilesApply_FIDS", FilesApply_FIDS);
                showPage("阅卷申请", "/FilesApply/Apply.aspx", 800, 500, false);
            }
        }

        function PrintCoverAll(PageNum, neworold) {
            var SelRow = $('#tabData').bootstrapTable('getSelections');
            if (SelRow.length > 0) {
                var FIDS = "";
                for (var i = 0; i < SelRow.length; i++) {
                    var FID = SelRow[i].ID;
                    FIDS += ",'" + FID + "'";
                }
                FIDS = FIDS.replace(',', '');//去掉第一个符号
                store.set("ConverFIDS", FIDS);
                store.set("Neworold", neworold);
                store.set("FilesClass", "Formal");
                showPage('卷皮打印预览', '/PrintCover' + PageNum + '.aspx', 1000, 600, false);
            }
        }

        function LitigationPrint() {
            var SelRow = $('#tabData').bootstrapTable('getSelections');
            if (SelRow.length > 0) {
                var FIDS = "";
                for (var i = 0; i < SelRow.length; i++) {
                    var FID = SelRow[i].ID;
                    FIDS += ",'" + FID + "'";
                }
                FIDS = FIDS.replace(',', '');//去掉第一个符号
                store.set("LitigationPrintFIDS", FIDS);

                showPage("档案目录打印", "LitigationPrint.aspx", 1200, 600, false);
            }
        }

        //获取子表数据
        function GetSonData(_FID, fileState) {
            //  DataLoading();
            $.ajax({
                type: "post",
                url: "ashx/Files.ashx",
                dataType: "json",
                async: true,
                data: { type: "GetLitigationDir", FID: _FID },
                success: function (msg) {
                    if (msg.result == 1) {
                        BindTab2(msg.JsonData, fileState);
                        $("#htmlTip").remove();

                        var txtsearch = $(".form-control[placeholder='搜索']").val();
                        if (txtsearch != null && txtsearch != '')   //默认表格查询优先
                        {
                            $("#tabData2 tbody tr td:not(.bs-checkbox)").each(function (i) {
                                var str = "<span class=\"bg-yellow\">" + txtsearch + "</span>";
                                var NewText = $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(txtsearch, str);
                                $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                            })
                        }
                        else {
                            var txtName = document.getElementById("txtName").value;
                            if (txtName != "") {
                                if (txtName.indexOf(",") != -1 || txtName.indexOf("，") != -1) {
                                    $("#tabData2 tbody tr td:not(.bs-checkbox)").each(function (i) {
                                        var NewText = $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).text();
                                        var strs = new Array(); //定义一数组
                                        strs = txtName.replaceAll("，", ",").split(","); //字符分割
                                        for (j = 0; j < strs.length; j++) {
                                            var str = "<span class=\"bg-yellow\">" + strs[j] + "</span>";
                                            NewText = NewText.replaceAll(strs[j], str);
                                        }
                                        $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                    })
                                }
                                else {
                                    $("#tabData2 tbody tr td:not(.bs-checkbox)").each(function (i) {
                                        var NewText = $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).text();
                                        var str = "<span class=\"bg-yellow\">" + txtName + "</span>";
                                        var NewText = $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(txtName, str);
                                        $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                    })
                                }
                            }

                            var txtSecondSearch = document.getElementById("txtSecondSearch").value;
                            if (txtSecondSearch != "") {
                                if (txtSecondSearch.indexOf(",") != -1 || txtSecondSearch.indexOf("，") != -1) {
                                    $("#tabData2 tbody tr td:not(.bs-checkbox)").each(function (i) {
                                        var NewText = $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).text();
                                        var strs = new Array(); //定义一数组
                                        strs = txtSecondSearch.replaceAll("，", ",").split(","); //字符分割
                                        for (j = 0; j < strs.length; j++) {
                                            var str = "<span class=\"bg-yellow\">" + strs[j] + "</span>";
                                            NewText = NewText.replaceAll(strs[j], str);
                                        }
                                        $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                    })
                                }
                                else {
                                    $("#tabData2 tbody tr td:not(.bs-checkbox)").each(function (i) {
                                        var NewText = $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).text();
                                        var str = "<span class=\"bg-yellow\">" + txtSecondSearch + "</span>";
                                        var NewText = $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).text().replaceAll(txtSecondSearch, str);
                                        $("#tabData2 tbody tr td:not(.bs-checkbox)").eq(i).html(NewText);
                                    })
                                }
                            }
                        }
                    }
                }
            });
        }

        function BindTab2(JsonData, fileState) {
            $('#tabData2').bootstrapTable('destroy');
            $('#tabData2').bootstrapTable({
                height: tabHeight - 50,
                data: JsonData != "" ? JSON.parse(JsonData) : "",
                dataType: "json",
                columns: [
                    { align: 'center', width: "50px", checkbox: true, sortable: true },
                    { field: 'DirIndex', align: 'center', width: "50px" },
                    { field: 'ArticleNo', align: 'left', width: "180px", sortable: true },
                    { field: 'Responsibilityer', align: 'left', width: "180px", sortable: true },
                    { field: 'DirName', align: 'left', width: "0" },
                    { field: 'DirDate', align: 'center', width: "100px", sortable: true },
                    { align: 'center', width: "80px", sortable: true, formatter: pageNoAndpageIndex },
                    //{ field: 'PageNo', align: 'center', width: "80px", sortable: true },
                    { field: 'Remark', align: 'center', width: "100px", sortable: true }
                ],
                //toolbar: '#toolbar',//工具按钮用哪个容器
                buttonsClass: "sm btn-white",//按钮class
                //pageSize: 100,//分页条数
                clickToSelect: true,//设置true 将在点击行时，自动选择单选或复选框
                singleSelect: false,//为true则禁止多选
                cache: false,//是否缓存
                cookie: true,//是否启用cookie
                cookieIdTable: "LitigationTab2",//cookie键值
                pagination: false,//是否分页
                showColumns: false,//是否显示所有的列
                showRefresh: false,//是否显示刷新按钮
                search: false,//是否启用搜索
                showPaginationSwitch: false,//是否显示分页切换按钮
                showExport: false,//是否启用导出
                striped: false,//是否显示行间隔色
                detailView: false,//是否显示切换视图列
                onDblClickRow: function (row, obj) { //双击行事件
                    if (fileState != 1) {
                        window.top.showFullPage("图像阅读器", "/See.aspx?FID=" + row.FID + "&DirID=" + row.ID);
                    }
                    else if (fileState == 1) {
                        showTip("档案被封存,无法查看原文件", 2, 2);
                    }
                }
            });
        }

        function pageNoAndpageIndex(value, row, index) {
            if (row.PageIndex == 'A' && row.PageIndex != null) {
                return [row.PageNo + "-" + row.PageIndex];
            }
            else {
                return [row.PageNo];
            }
        }

    </script>
}
